home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / science / sm32a.zip / SYMBMATH.H19 < prev    next >
Text File  |  1994-08-01  |  6KB  |  135 lines

  1.         3.4.  Libraries and Packages
  2.     A library is a file of an external function, which filename is its
  3. function name within 8 letters plus extension .li. e.g. the library named
  4. sin.li is a file of the sin(x) function definition.
  5.     The library (the *.li file) is similar to the MS-DOS *.bat file.
  6. You need not to load or read the library by any command. SymbMath
  7. automatically load the library when it is needed. For example, when you
  8. use the sin(x) function first time, the library sin.li will be autoloaded.
  9. The library must be in the default directory, otherwise the library is not
  10. loaded and the function is not working. Only the assignments in the library
  11. can be loaded, and others in the library will be omitted, but all of these
  12. assignments will be not evaluated when they are loaded. You can clear the
  13. library sin.li from memory by clear(sin(x)).
  14.     You can have libraries (external functions) as many as your disk
  15. space available. You should use the "one function per file" convenience.
  16.         Note that all names of the variables in libraries and packages
  17. are public (global) except for those declared by local() and name
  18. conflicts must be avoided.
  19.     You can protect a library (e.g. sin.li) for write-protect by 
  20. the DOS command:
  21.         attrib +r sin.li
  22. or for hidden-protect by the DOS command: 
  23.         attrib +h sin.li
  24.     You can remove the write-protect of a library by the DOS command:
  25.         attrib -r sin.li
  26. or remove the hidden-protect by the DOS command: 
  27.         attrib -h sin.li
  28.  
  29.     A package is the SymbMath program file which filename has not 
  30. extension .li. It is recommanded that its filename has the extension .sm.
  31.         A package is similiar to a libarary, but the package must be read
  32. by a command
  33.         readfile("filename")
  34.     The filename can be any MS-DOS filename. It is recommended that
  35. the filename is same function name used in your program, plus the
  36. extension .sm. e.g. inte.sm is the filename of the integral package as
  37. the name of integral function is inte(). If the file is not in the
  38. current directory, the filename should include the directory. e.g.
  39.                    readfile("directory\filename")
  40.     After reading the package, you can call the commands in the
  41. package from your program.
  42.     The readfile() command must be in a single line anywhere.
  43.     Many packages can be read at a time.
  44.     You can convert a package of f.sm into a library by renaming f.sm
  45. to f.li for auto loading, or a library f.li to a package by renaming
  46. f.li to f.sm for not auto loading.
  47.     There are many libraries and packages. The following are some 
  48. of them.
  49.  
  50.         Table 3.4.1      Libraries and Packages
  51. ------------------------------------------------------------------------
  52. File Name               Package Function
  53.  
  54. plot.li                plotting functions.
  55. d.li                   derivatives.
  56. inte.li                integrals.
  57. sin.li                 sin(x) function.
  58. cos.li                 cos(x) function.
  59. fac.li                 n!.
  60. sign.li                sign(x) function.
  61. abs.li                 abs(x) function.
  62. arg.li                 arg(x) function.
  63. sum.li                 sum function.
  64. NInte.li               numeric integration.
  65. NSolve.li              numeric solver of equation.
  66. DSolve.li              differential equation solver.
  67. gamma.li               gamma function.
  68. ei.li                  exponential integral function.
  69. series.li              Taylor series.
  70. partSum.li             partial sum.
  71. infSum.li              infinite sum.
  72. sinh.li                sinh(x) function.
  73. cosh.li                cosh(x) function.
  74. average.li             average([x]) function.
  75. listSum.li             sum of list of data.
  76. react.li               chemical reactions database.
  77. phoneNo.li             phone No. database.
  78. .......................................................................
  79. init.sm                 initial package when running the program in 
  80.             the Input window. It contains switches on the 
  81.             default status.
  82.  
  83. chemical.sm             the atomic weight of chemical elements.
  84. tExpand.sm              expansion of trig functions.
  85. expandLn.sm             expand ln(x*y).
  86. ExpandGa.sm             expand gamma(n,x).
  87. ExpandEi.sm             expand ei(n,x).
  88. units.sm                an units conversion.
  89. listPlot.sm             plotting a list of data.
  90. plotData.sm             intefacing software PlotData.
  91. -----------------------------------------------------------------------
  92.     
  93.         You can get help for all libraries by the library Index command 
  94. in the Help menu. You first open the library index window by this command,
  95. then open a library by selecting its library name in the library index
  96. window.
  97.  
  98.         3.4.1  Initial Package
  99.  
  100.     When a program is run in the Input window, SymbMath first
  101. automatically reads (or runs) the initial package "init.sm". 
  102. The commands in the "init.sm" package seems to be the SymbMath system 
  103. commands. You can read other packages (e.g. f.sm) in the initial 
  104. package "init.sm", so the commands in the package "f.sm" seems 
  105. to be in SymbMath system. You do this by adding the readfile("f.sm")
  106. into the init.sm file:
  107.         readfile("f.sm")
  108.         
  109.         3.4.2  ExpandLn Package
  110.     The lnexpand.sm package does the logarithmic expansion.
  111. e.g. ln(a*b) is expanded into ln(a)+ln(b).
  112.             
  113.         3.4.3  Chemical Calculation Package
  114.     SymbMath recognizes 100 symbols of chemical elements and 
  115. converts them into their atomic weights after the chemical package of
  116. "Chemical.sm" is read.
  117.  
  118.     Example 3.4.3.1. 
  119. Calculate the weight percentage of the element C in the molecule CH4.
  120.  
  121. IN:  readfile("chemical.sm")
  122. IN:  numeric:=on
  123. IN:  C/(C+H*4)*100*%
  124. OUT: 74.868 %
  125.  
  126.     Example 3.4.3.2. 
  127. Calculate the molar concentration of CuO when 3 gram of CuO is in 0.5 
  128. litre of a solution.
  129.  
  130. IN:  readfile("chemical.sm")
  131. IN:  numeric:=on
  132. IN:  g:=1/(Cu+O)*mol
  133. IN:  3*g/(0.5*l)
  134. OUT: 0.07543 mol/l
  135.